# coding:utf-8
module Admin::AdvertiseGroupsHelper
  def rule_check_box f, area, father_area, advertise_group
    class_name = father_area && "#{father_area.class.name.underscore}_#{father_area.id}"
    output = f.check_box "#{area.class.name.underscore}_#{area.id}",style: "margin-left:10px;",class: "#{area.class.name.underscore.pluralize} #{class_name}",checked: area.this_advertise_group?(advertise_group)
     if area.conflict_advertise_group? advertise_group
      output << %Q{<span class="label label-warning" style="display:inline;margin-left:10px;">
        <strong>警告!</strong> 该区域已使用广告规则: #{area.advertise_rule.advertise_group.name}.</span>
      }.html_safe
    end
    output
  end
end